/* 
 * Copyright (C) 2012 UTSChedule
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package utsc.apps.utschedule.widget;

import utsc.apps.utschedule.R;
import android.content.Context;
import android.text.TextUtils.TruncateAt;
import android.widget.Button;

public class ObjectButtonView extends Button {

	private Object _object;
	public static final int MAX_WIDTH=120; 
	public static final int MAX_HEIGHT=60;
	private int _btnRgResource=R.drawable.btn;
	
	public ObjectButtonView(Context context,Object object,int btnBgResource) {
		super(context);
		_object=object;
		setText(_object.toString());
		setEllipsize(TruncateAt.END);
		setSingleLine(true);
		set_btnRgResource(btnBgResource);
		//setBackgroundDrawable(getResources().getDrawable(R.drawable.btn));
	}
		
	public void set_object(Object _object) {
		this._object = _object;
	}

	public int get_btnRgResource() {
		return _btnRgResource;
	}

	public Object get_object() {
		return _object;
	}
	
	public void set_btnRgResource(int _btnRgResource) {
		this._btnRgResource = _btnRgResource;
		setBackgroundDrawable(getResources().getDrawable(_btnRgResource));
	}
	
}
